<template>
    <div class="small-video">
        <div class="link" v-for="item in smallvideo" :key="item.id">
            <div class="short-video-item" @click="path(item.id, item)">
              <img :src="item.shareInfo.img" alt="" />
              <div class="title">{{ item.title }}</div>
              <div class="video-info">
                <img :src="item.user.avatarurl" alt="" class="userimg" />
                <div class="user-name">{{ item.user.nickName }}</div>
                <img
                  src="https://p1.meituan.net/moviemachine/5377c2c03dacf20b6e286e3e72dd57911272.png@80q"
                  class="count"
                  alt=""
                />
                <div class="like-count">{{ item.upCount }}</div>
              </div>
            </div>
        </div>
    </div>
</template>

<script>
export default {
  props: {
    smallvideo: Array,
  },
  methods: {
    path(vid, Object) {
      this.$router.push({ path: "shortplayer/" + vid, query: { data: Object } });
    },
  },
};
</script>

<style lang="less" scoped>
.small-video {
  margin-top: 50px;
  .link {
    cursor: pointer;
    display: inline-block;
    text-decoration: none;
    .short-video-item {
      position: relative;
      display: inline-block;
      width: 49.5%;
      height: 300px;
      margin: 0 1.875px 2px 0;
      background-position: 50%;
      background-size: cover;
      img {
        width: 185.63px;
        height: 300px;
      }
      .title {
        width: 170px;
        height: 42px;
        position: absolute;
        color: #fff;
        margin: 0 8px;
        position: absolute;
        top: 210px;
        left: 0;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      .video-info {
        display: flex;
        align-items: center;
        bottom: 0.28rem;
        font-size: 0.26rem;
        width: 170px;
        height: 21.5px;
        margin: 0 8px;
        position: absolute;
        color: #fff;
        top: 260px;
        left: 0;
        z-index: 2;
        .userimg {
          width: 21.5px;
          height: 21.5px;
          border-radius: 50%;
        }
        .user-name {
          margin: 0 8px;
          flex: 1;
          display: inline-block;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
        .count {
          display: inline-block;
          width: 18px;
          height: 18px;
          margin-right: 3px;
          background-color: transparent;
        }
        .like-count {
          width: 37px;
          overflow: hidden;
          white-space: nowrap;
          text-overflow: ellipsis;
        }
      }
    }
  }
}
</style>

